@extends('base')
@section('title', 'Home page')
@section('csses')
<style type="text/css">
  .right_link {
    line-height: 24px;
  }

  .right_link:hover {
    color: #990000;
    text-decoration: underline;
  }
</style>
@endsection
@section('content')
<div>
  <div class="col-md-8 col-xs-12 main_l">
    <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
      <!-- Indicators -->
      <ol class="carousel-indicators">
        @for($i=0; $i<count($pictures); $i++)
        <li data-target="#carousel-example-generic" data-slide-to="0" class="{{$i==0 ? 'active' : ''}}"></li>
        @endfor
      </ol>
      <!-- Wrapper for slides -->
      <div class="carousel-inner" role="listbox">
        @foreach($pictures as $picture)
        <div class="item {{ $loop->first ? 'active' : '' }}">
          @if($picture->issue_id)
          <a href="{{ action('ArticleController@index', ['id' => $picture->id]) }}">
            <img src="{{asset($picture->getFirstImg())}}" >
            <div class="carousel-caption">
              {{ $picture->title }}
            </div>
          </a>
          @else
          <a href="{{ action('NewsController@notice', ['id' => $picture->id]) }}">
            <img src="{{ asset('uploads/'.$picture->cover) }}" >
            <div class="carousel-caption">
              {{ $picture->title }}
            </div>
          </a>
          @endif
        </div>
        @endforeach
      </div>
      <!-- Controls -->
      <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
        <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
        <span class="sr-only">Previous</span>
      </a>
      <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
        <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
        <span class="sr-only">Next</span>
      </a>
    </div>
  </div>
  <div class="col-md-4 col-xs-12 main_r ">
    <div class="main_r1">
      <div class="col-md-6 col-xs-6 main_pic  ">
        <a class="image-popup-vertical-fit" href="{{ asset('uploads/' . $current_issue->cover) }}">
          <img src="{{ asset('uploads/' . $current_issue->cover) }}" width="150">
        </a>
      </div>
      <div class="col-md-6 col-xs-6 main_url">
        <a href="{{ url('/current/issue') }}"><strong><span class="font-col">Current Issue</span> </strong> </a><br>
        Volume {{ $current_issue->volume }} Issue {{ $current_issue->issue }}<br>
        18 July 2018<br>
        <a href="#" style="color:#FFF;">Table of Content</a>
        <div style=" height:20px;"></div>
        <strong><span class="bais">Bimonthly</span> </strong><br>
        Founded in 1980<br>
        ISSN: 2095-8137<br>
        CN: 53-1229/Q<br>
      </div>
    </div>
  </div>
</div>
<div class="col-md-8 col-xs-12 main_l">
  <div class="main_l1">
    <div class="tit"><h2>Featured Articles</h2></div>
    <p>
      @if($featured)
      <a href="{{ action('ArticleController@index', ['id' => $featured->id]) }}" style="color: black;"><strong>{{ $featured->getTitle() }} </strong></a>
      {!! $featured->getAuthorList() !!} <br/>
      {{ $featured->issue->formatIssueText() }}
      @endif
    </p>
  </div>

  <div class="main_l1">
    <div class="tit" style="background-color: #e1661b;">
      <h2 style="color: #e1661b;">Current Issue</h2>
    </div>
  </div>
  @include('sections.issue_list', ['issue' => $current_issue, 'articles' => $articles])
  <div class="main_l1">
    <div class="tit" style="background-color: #0f64b3;">
      <h2 style="color: #0f64b3;"><a href="{{ route('collection.index') }}">Collections</a></h2>
    </div>
    <div class="justify-content row">
        <div class="col-md-12">
        @foreach($collections as $collection)
        <div class="col-xs-6 col-md-3">
            <div>
            <a title="{{ $collection->name }}" href="{{ route('collection.article', ['id' => $collection->id]) }}">
                <img src="{{ asset('uploads/' . $collection->cover) }}" width="130" height="170">
            </a>
            </div>
            <div>
            <a title="{{ $collection->name }}" href="{{ route('collection.article', ['id' => $collection->id]) }}">{{ $collection->name }}</a>
            </div>
        </div>
        @endforeach
      </div>
    </div>
  </div>

  <div class="main_l1">
    <div class="tit" style="background-color: #0f64b3;">
      <h2 style="color: #0f64b3;"><a href="{{ route('volume.show') }}">Archive</a></h2>
    </div>
    <div class="justify-content row">
        <div class="col-md-12">
        @foreach($archive_issue as $archive)
        <div class="col-xs-6 col-md-3">
            <div>
            <a href="{{ action('IssueController@index', ['id' => $archive->id]) }}">
                <img src="{{ asset('uploads/' . $archive->cover) }}" width="130" height="170">
            </a>
            </div>
            <div>
            <a href="{{ action('IssueController@index', ['id' => $archive->id]) }}">{{ $archive->year }} Vol.{{ $archive->volume }}
                No.{{ $archive->issue }}
            </a>
            </div>
        </div>
        @endforeach
      </div>
    </div>
  </div>
</div>
<div class="col-md-4 col-xs-12 main_r">
  <div class="main_r2">
    <div class="news">
      <h3>ZR News</h3>
      <ul>
        @foreach($news as $key => $value)
        <li>
          <a href="{{ route('news.show', ['slug' => $value->id]) }}">{{ $value->short_description  }}</a><br>
          <span class="time">{{ substr($value->created_at, 0, 10) }}</span>
        </li>
        @endforeach
      </ul>
      <div class="more_news">
        <a href="{{ route('news.home', ['slug' => 'news']) }}">More&gt;&gt;</a>
      </div>
    </div>
    <div class="most">
      <h3>{{ __('Most Downloaded in ZR Website') }}</h3>
      <ul>
        <table cellspacing="0" cellpadding="0" width="100%" border="0" align="center" style="margin-bottom: 15px">
          <tbody>
            
              @foreach($articles_by_download as $article)
              <tr>
                <td width="87%" valign="top">
                  <a class="right_link" target="_blank" href="{{ action('ArticleController@index', ['id' => $article->id]) }}">{!! $article->title !!}</a>
                </td>

              </tr>
              @endforeach
          </tbody>
        </table>
      {{-- <div class="mores">
        <a href="{{ url('article/press') }}">More&gt;&gt;</a>
      </div> --}}
    </div>
    <div class="most">
      <h3>{{ __('Most Viewed in ZR Website') }}</h3>
      <ul>
        <table cellspacing="0" cellpadding="0" width="100%" border="0" align="center" style="margin-bottom: 15px">
          <tbody>
            
              @foreach($articles_by_view as $article)
              <tr>
                <td width="87%" valign="top">
                  <a class="right_link" target="_blank" href="{{ action('ArticleController@index', ['id' => $article->id]) }}">{!! $article->title !!}</a>
                </td>

              </tr>
              @endforeach
          </tbody>
        </table>
      {{-- <div class="mores">
        <a href="{{ url('article/press') }}">More&gt;&gt;</a>
      </div> --}}
    </div>
    <div class="most">
      <h3>{{ __('Most Cited in Web of Science') }}</h3>
      <ul>
        <table cellspacing="0" cellpadding="0" width="100%" border="0" align="center" style="margin-bottom: 15px">
          <tbody>
              @foreach($articles_by_wos as $article)
              <tr>
                <td width="87%" valign="top">
                  <a class="right_link" target="_blank" href="{{ action('ArticleController@index', ['id' => $article->id]) }}">{!! $article->title !!}</a>
                </td>
              </tr>
              @endforeach
          </tbody>
        </table>
      {{-- <div class="mores">
        <a href="{{ url('article/press') }}">More&gt;&gt;</a>
      </div> --}}
    </div>
    <div class="most">
      <h3>{{ __('Most Cited in Baidu Scholar') }}</h3>
      <ul>
        <table cellspacing="0" cellpadding="0" width="100%" border="0" align="center" style="margin-bottom: 15px">
          <tbody>
              @foreach($articles_by_baidu as $article)
              <tr>
                <td width="87%" valign="top">
                  <a class="right_link" target="_blank" href="{{ action('ArticleController@index', ['id' => $article->id]) }}">{!! $article->title !!}</a>
                </td>
              </tr>
              @endforeach
          </tbody>
        </table>
      {{-- <div class="mores">
        <a href="{{ url('article/press') }}">More&gt;&gt;</a>
      </div> --}}
    </div>
{{--     <div class="most">
      <h3>Article in Press</h3>
      <ul>
        <table cellspacing="0" cellpadding="0" width="100%" border="0" align="center" style="margin-bottom: 15px">
          <tbody>
            <tr>
              @foreach($press as $key => $value)
              @if($loop->first)
              <td width="87%" valign="top">
                <a target="_blank" href="{{ action('ArticleController@index', ['id' => $value->id]) }}"><span class="abstract">{{ $value->title }}</span></a>
                <br>
                <span style="font-size: 13px;">{{ $value->name }}</span></td>
                @endif
                @endforeach
              </tr>
            </tbody>
          </table>
          <div class="mores">
            <a href="{{ url('article/press') }}">More&gt;&gt;</a>
          </div>
        </div> --}}
        
        <div class="most link">
          <h3>Links</h3>
          <ul>
            <li>
              <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/journals/2884/">PubMed Central</a><br>
            </li>
            <li>
              <a target="_blank" href="https://www.scopus.com/sourceid/19700173308?origin=sbrowse">ZR CiteScore</a><br>
            </li>
            <li>
              <a target="_blank" href="https://apps.webofknowledge.com/WOS_GeneralSearch_input.do?locale=en_US&amp;errorKey=&amp;viewType=input&amp;pro">Web of Science</a><br>
            </li>
            <li>
              <a target="_blank" href="https://doaj.org/">DOAJ--Directory of Open Access Journals</a><br>
            </li>
            <li>
              <a target="_blank" href="http://www.bioline.org.br/toc?id=zr">Bioline International</a><br>
            </li>
            <li>
              <a target="_blank" href="http://www.scimagojr.com/journalsearch.php?q=19700173308&amp;tip=sid&amp;exact=no">SCImago Journal &amp; Country Rank</a><br>
            </li>
            {{-- <div class="mores"><a href="#">More&gt;&gt;</a></div> --}}
          </ul>
        </div>
      </div>
    </div>
    @endsection
    @section('scripts')
    <script type="text/javascript">
    var iobj1= document.getElementsByName("ck");
    var iobj2 = document.getElementsByName("checkAll");
    function selectAll(){
    if (iobj2[0].checked == true) {
    for (var i = 0; i < iobj1.length; i++) {
    if (!iobj1[i].checked) {
    iobj1[i].checked = true;
    }
    iobj1[i].checked = true;
    }
    }else {
    for (var i = 0; i < iobj1.length; i++) {
    if (iobj1[i].checked) {
    iobj1[i].checked = false;
    }
    iobj1[i].checked = false;
    }
    }
    }
    </script>
    @endsection